package com.example.daxiguaforharmony.game.core.base;

import ohos.agp.render.Canvas;
import ohos.agp.render.Paint;

public class DisplayObject {
    public float x = 0f;
    public float y = 0f;
    public float scaleX = 1f;
    public float scaleY = 1f;
    public float width = 0f;
    public float height = 0f;
    public float rawWidth = 0f;
    public float rawHeight = 0f;
    public float rotation = 0f; // 角度, 0f-360f
    public float alpha = 1f;    // 透明度, 0f-1f
    public boolean visible = true;
    public String name = null;

    public DisplayObjectContainer _parent = null;

    public DisplayObject() {
    }

    public void setParent(DisplayObjectContainer parent) {
        if (this._parent != null) {
            this._parent.removeChild(this);
        }
        this._parent = parent;
    }

    public DisplayObjectContainer getParent() {
        return this._parent;
    }

    public void removeFromParent() {
        if (this._parent != null) {
            this._parent.removeChild(this);
            this._parent = null;
        }
    }

    public void render(Canvas canvas, Paint paint) {

    }

    public void destory() {

    }
}
